package org.asiainfo.system.dubbo;

import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboService;
import org.asiainfo.common.core.utils.MapstructUtils;
import org.asiainfo.system.api.RemoteRoleService;
import org.asiainfo.system.api.domain.vo.RemoteRoleVo;
import org.asiainfo.system.domain.vo.SysRoleVo;
import org.asiainfo.system.service.SysRoleService;
import org.springframework.stereotype.Service;

/**
 * 角色服务
 *
 * @author dotor-ww
 */
@Service
@DubboService
@RequiredArgsConstructor
@Slf4j
public class RemoteRoleServiceImpl implements RemoteRoleService {

    private final SysRoleService sysRoleService;

    /**
     * 根据角色ID查询角色信息
     *
     * @param roleId 角色ID
     * @return 角色信息
     */
    @Override
    public RemoteRoleVo selectRemoteRoleByRoleId(Long roleId) {
        SysRoleVo sysRoleVo = sysRoleService.queryById(roleId);
        return MapstructUtils.convert(sysRoleVo, RemoteRoleVo.class);
    }
}
